Skip to content

feat: copy selected traces to other sections#97

Open
dustenhubbard wants to merge 1 commit into
SynapseWeb:mainfrom
dustenhubbard:contrib/copy-to-sections
Open

feat: copy selected traces to other sections#97
dustenhubbard wants to merge 1 commit into
SynapseWeb:mainfrom
dustenhubbard:contrib/copy-to-sections

Conversation

@dustenhubbard

Copy link
Copy Markdown
Member

Summary

Copying a trace only pastes it into the current section, so placing the same trace at the same location across many sections means navigating to each one and pasting. This adds a Copy to sections action: copy the selected trace(s), choose target sections (individual numbers and ranges, e.g. 10-20 or 5, 8, 11), and place them into all of those sections at the same field (x, y) location in one step.

Approach

  • New CopyToSectionsDialog (PyReconstruct/modules/gui/dialog/copy_to_sections.py) collects the target-section spec; parse_section_spec accepts individual numbers and ranges.
  • Series.copyTracesToSections re-projects each trace's field points through each target section's transform, so the trace lands at the same field location regardless of that section's alignment.
  • Wired into the trace context menu (field_widget_2_trace.py, context_menu_list.py).

Robustness

  • Range specs are intersected against the existing sections without materializing the full range, so a large typed bound (e.g. 1-999999999) cannot hang the UI.
  • Tokens are validated so non-numeric input is reported as invalid instead of raising.
  • Requested sections that do not exist are surfaced to the user rather than silently dropped.
  • A target section with a non-invertible transform is skipped and reported, never crashing or writing bad geometry.
  • Tests: tests/test_copy_traces_to_sections.py.

Closes #94

Add a "Copy to sections..." action that copies the selected trace(s)
onto other sections at the same field location. Each trace's field
coordinates are re-projected through every target section's own inverse
transform (computed once per section), so the traces land at the
identical field x-y regardless of how each section is aligned. Sections
with a non-invertible transform are skipped and reported rather than
written to.

Trace attributes are preserved and the source (current) section is left
unchanged. Target sections are chosen by number or inclusive range in a
small picker dialog; the parser validates tokens without materializing
typed ranges (so a huge upper bound cannot hang the UI) and reports
requested sections that do not exist instead of silently dropping them.

The action is available at the field context-menu top level (next to
Copy) and in the trace list. Includes tests for the parser and the
data-model copy operation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Copy To": copy a trace to multiple chosen sections at the same x-y location

1 participant